#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1005;

int n, m;
int vis[N], primes[N], tot;
void init(int n) {
  vis[1] = 1;
  rep(i, 2, n) {
    if (!vis[i]) primes[++tot] = i;
    rep(j, 1, tot) {
      int k = primes[j] * i;
      if (k > n) break;
      vis[k] = 1;
      if (i % primes[j] == 0) break;
    }
  }
}
vector<pll> ans;
void dfs(int s, int mx, int sum, ll now, ll cnt) {
  if (now > n || sum > m || mx < 1) return;
  ans.push_back(pll(now, cnt));
  rep(i, 1, mx) {
    now *= primes[s];
    dfs(s + 1, min(i, m - sum - i), sum + i, now, cnt * (i + 1));
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  init(1000);
  cin >> n;
  m = floor(log2(n));
  dfs(1, m, 0, 1, 1);
  sort(ans.begin(), ans.end());
  ll now = 1, cnt = 1;
  for (pii p : ans) {
    if (p.second > cnt) now = p.first, cnt = p.second;
  }
  cout << now;
  return 0;
}
